﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace PSE.Framework.UI.Controls.SmartClient
{
    public class PositiveToNegativeConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int retorno = System.Convert.ToInt32(value);
            if (retorno > 0)
                return (retorno * -1);
            else
                return retorno;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int retorno = System.Convert.ToInt32(value);
            if (retorno < 0)
                return (retorno * -1);
            else
                return retorno;
        }

        #endregion
    }
}
